﻿using System.Collections.Generic;
using BlackJack.CardGameFramework;
using System.Windows.Forms;
using System;
using System.Collections;

namespace BlackJack
{
    public class PlayerCollection
    {
        public PlayerCollection(int numPlayers, int initBalance)
        {
            switch (numPlayers)
            {
                case 1:
                    // setup a single Player, a single PlayerPictureControl, and a single PlayerCarsControl
                    players = new Player[1]; // this should be an array that holds the players dynamically
                    
                    players[0] = new Player(initBalance);
                    break;
                case 2:
                    players = new Player[2]; // this should be an array that holds the players dynamically

                    for (int i = 0; i < 2; i++)
                    {
                        players[i] = new Player(initBalance);
                    }
                    
                    break;
            }
                   

        }
        
        #region Fields
        private Player[] players;
        private int currentPlayerToken = 0;         
        #endregion Fields

        #region Methods
        public int PlayerToken
        { 
            get 
            { 
                return currentPlayerToken; 
            } 
            set 
            { 
                currentPlayerToken = value; 
            } 
        }

        public void NextPlayer()
        {
            PlayerToken += 1;
        }

        public Player returnCurrentPlayer()
        {
            return players[PlayerToken];
        }

    

        public Player returnRequestedPlayer(int token)
        {
            return players[token];
        }
        
        #endregion Methods
        

        
        
    }
}